import requests
import json

# 定义请求URL
url = "https://push2.eastmoney.com/api/qt/ulist/get"

# 定义请求参数
params = {
    # "cb": "jQuery3510096865461694748484_17154894122",
    "fltt": "1",
    "invt": "2",
    "fields": "f12,f13,f14,f1,f1,f2,f4,f3,f152,f6,f104,f105,f106",
    "secids": "1.00001,0.3901",
    "ut": "fa5fd1943c7b386f172d6893dbfba10b",
    "pn": "1",
    "pz": "20",
    "wbp2u": "636413872167674%7C0%7C1%7C0%7Cweb",
    "_": "17154894123"
}

# 发起请求
response = requests.get(url, params=params)

# 检查响应状态码
if response.status_code == 200:
    # 解析JSONP响应，去除回调函数包裹
    data = response.text
    # 根据实际返回的数据结构处理数据，打印或进一步操作
    print(data)
else:
    print(f"请求失败，状态码：{response.status_code}")

##################################################################################

# 定义请求URL
url = "https://push2.eastmoney.com/api/qt/pkyd/get"

# 定义请求参数
params = {
    # "cb": "jQuery3510096865461694748484_171548941218",
    "fields": "f1,f2,f3,f4,f5,f6,f7",
    "secids": "0.300215",
    "lmt": "40",
    "ut": "fa5fd1943c7b386f172d6893dbfba10b",
    "wbp2u": "6364138721676%7C0%7C1%7C0%7Cweb",
    "_": "171548941239"
}

# 发送GET请求
response = requests.get(url, params=params)

# 检查响应状态码
if response.status_code == 200:
    # 响应数据是JSONP格式，但可能被包裹在一个函数调用，需处理
    data = response.text

    print(data)

else:
    print(f"请求失败，状态码：{response.status_code}")